home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C
/
Frameworks
/
Grant's CGI Framework 1.0b14
/
Interface
/
DialogFunc.c
< prev
next >
Wrap
Text File
|
1996-04-11
|
2KB
|
74 lines
/*****
*
* DialogFunc.c
*
* This is a support file for "Grant's CGI Framework".
* Please see the license agreement that accompanies the distribution package
* for licensing details.
*
* Copyright ©1995,1996 by Grant Neufeld
* grant@acm.com
* http://arpp.carleton.ca/grant/mac/grantscgi/
*
*****/
#include "MyConfiguration.h"
#if kCompileWithForeground
#include <Threads.h>
#include "compiler_stuff.h"
#include "constants.h"
#include "globals.h"
#include "Events.h"
#include "WindowInt.h"
#include "DialogFunc.h"
/*** FUNCTIONS ***/
/* This function responds to update, and activate events, and key presses.
return, enter, Command-. and esc select the 'OK' button (kDefaultButtonID).
(There's no Cancel button) */
pascal Boolean
defaultAlert1ButtonEventFilter ( DialogPtr theDialog, EventRecord *theEvent, short *itemHit)
{
Boolean result;
char key;
short itemType;
Handle itemHandle;
Rect itemRect;
long finalTicks;
result = false;
switch ( theEvent->what )
{
case keyDown :
key = (char)( theEvent->message & charCodeMask );
if ( (key == (char)kReturnKey) || (key == (char)kEnterKey) ||
(key == (char)kEscapeKey) ||
((key == (char)kPeriodKey) && (theEvent->modifiers & cmdKey)) )
{
GetDialogItem ( theDialog, kDefaultButtonID, &itemType, &itemHandle, &itemRect );
HiliteControl ( (ControlHandle)itemHandle, nil );
Delay ( (long)kVisualDelay, &finalTicks );
HiliteControl ( (ControlHandle)itemHandle, nil );
result = true;
*itemHit = (short)kDefaultButtonID;
}
break;
}
return result;
} /* defaultAlert1ButtonEventFilter */
#endif /* kCompileWithForeground */
/***** EOF *****/